/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CPainelBdCenarioEdicao.java
 *
 * Created on 19/09/2010, 09:44:47
 */

package rpt.bd.cenario;


/**
 *
 * @author Roberto
 */
public class CPainelBdCenarioEdicao extends CPainelBdCenario {

    //protected CCenarioBdEdicao fCenarioBdEdicao = null;
    //protected CEstruturaRegistroBdCenarioEdicao fEstruturaRegistroBdCenarioEdicao = null;
    protected String fNomeCampoChavePrimaria;
    protected String fNomeCampoDescricao;

    public CPainelBdCenarioEdicao() {
        initComponents();
    }

    public CPainelBdCenarioEdicao(CPersistenciaBd aPertinenciaBd) {
        super((CPersistenciaBdCenario)aPertinenciaBd);
    }

    public CPainelBdCenarioEdicao(CPersistenciaBdCenario aPertinenciaBd) {
        super(aPertinenciaBd);
    }

    public CGlobal getGlobal() {
        return fCenarioBd.getGlobal();
    }

    public void setCenarioBd(CCenarioBdEdicao aCenarioBdEdicao) {
        fCenarioBd = aCenarioBdEdicao;
        fPersistenciaBd = fCenarioBd.getPertinenciaBd();
    }

    public CCenarioBd getCenarioBdEdicao() {
        return fCenarioBd;
    }
/*
    public CEstruturaRegistroBdCenarioEdicao getEstruturaRegistroBd(CCenarioBdEdicao aCenarioBdEdicao) {
        CEstruturaRegistroBdCenario e = super.getEstruturaRegistroBdCenario(aCenarioBdEdicao);
        fCenarioBdEdicao = aCenarioBdEdicao;
        return null;
    }
*/
    public CEstruturaRegistroBd getEstruturaRegistroBd(
        CCenarioBd aCenarioBd,
        String aNomeCampoId,
        String aNomeCampoDescricao) {
        //
        fCenarioBd = aCenarioBd;
        //
        fNomeCampoChavePrimaria = aNomeCampoId;
        fNomeCampoDescricao = aNomeCampoDescricao;
        //
        if (fEstruturaRegistroBd == null) {
            fEstruturaRegistroBd = criarEstruturaRegistroBd();
            getEstruturaCamposRegistroBd();
        }
        return fEstruturaRegistroBd;
    }

    @Override
    public CEstruturaRegistroBd criarEstruturaRegistroBd() {
        return new CEstruturaRegistroBdCenarioEdicao((CCenarioBdEdicao)fCenarioBd,fNomeCampoChavePrimaria,fNomeCampoDescricao);
    }

    protected void getEstruturaCamposRegistroBd() {
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

}
